<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0px;
        padding: 0px;
      }
      .box {
        height: 100vh;
        width: 100vw;
        background-color: #aaa;
      }
      .top {
        background-color: skyblue;
        width: 100%;
        height: 50px;
      }
      .top-assist {
        width: 100%;
        height: 22px;
        background-color: goldenrod;
        overflow: hidden;
        transition: all 1s;
      }
      .top-assist:hover {
        height: auto;
      }
      .top-assist-1 {
        width: 100%;
        height: auto;
        background-color: goldenrod;
      }
      .top-assist-main {
        transform: translateY(calc(-100% + 22px));
        transition: all 1s;
      }
      .top-assist-main:hover {
        transform: translateY(0px);
      }
      .top-assist-main1 {
        transform: translateY(0px);
        animation: animo1 1s ease-in 1s;
      }
      .text {
        text-align: center;
      }
      .main {
        width: 100%;
        background-color: pink;
        height: 100%;
      }

      @keyframes animo1 {
        from {
          transform: translateY(calc(-100% + 22px));
        }
        to {
          transform: translateY(0px);
        }
      }
    </style>
  </head>
  <body>
    <div>
      <div class="box">
        <div class="top"></div>
        <div class="top-assist">
          <div class="top-assist-main">
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <p>12312</p>
            <div class="text">点我下拉</div>
          </div>
        </div>
        <div class="main"></div>
      </div>
    </div>
  </body>
  <script>
    window.onload = () => {
      document.querySelector(".text").addEventListener("click", clickHandle);

      function clickHandle() {
        console.log("momo", !!document.querySelector(".top-assist-1"));

        if (!document.querySelector(".top-assist-1")) {
          let topAssist = document.querySelector(".top-assist");
          let topMain = document.querySelector(".top-assist-main");

          topAssist.setAttribute("class", "top-assist top-assist-1");
          topMain.setAttribute("class", "top-assist-main top-assist-main1");
        } else {
          let topAssist1 = document.querySelector(".top-assist-1");
          let topMain1 = document.querySelector(".top-assist-main1");

          topAssist1.setAttribute("class", "top-assist");
          topMain1.setAttribute("class", "top-assist-main");
        }
      }
    };
  </script>
</html>
